﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Web;

namespace MyLocalChurch.Business
{
    public static class StringParser
    {
        public static DateTime? ParseDateOrNull(string dateString)
        {
            if (string.IsNullOrEmpty(dateString))
                return null;

            DateTime date;
            if (DateTime.TryParseExact(dateString, new[] {"MM/dd/yyyy", "M/d/yyyy"},
                                       CultureInfo.InvariantCulture, DateTimeStyles.None, out date))
                return date;

            return null;
        }
    }
}